package com.info.zhiduoduo.repository.mapper.notice;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.notice.CeoNoticeRecord;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author bob
 * @since 2020-01-04
 */
public interface CeoNoticeRecordMapper extends BaseMapper<CeoNoticeRecord> {

	@Delete(" delete from zdd_ceo_notice_record where type = #{type} and bizid = #{bizid} ")
	int del(int type, int bizid);

	@Select(" select * from zdd_ceo_notice_record where type = #{type} and bizid = #{bizid} ")
	CeoNoticeRecord findOne(int type, int bizid);

	@Update(" update zdd_ceo_notice_record set state = 3 where type = #{type} and bizid = #{bizid} and state = 1")
	int cancelNotice(int type, int bizid);

	@Update(" update zdd_ceo_notice_record set state = 2 where type = #{type} and bizid = #{bizid} ")
	int sentNotice(int type, int bizid);

	@Update(" update zdd_ceo_notice_record set state = 3 where type in(4,5,6) and bizid = #{bizid} and state = 1")
	int cancelInvoiceNotice(int projectid);
}
